package utils.file;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class FileUtils {

    public static void main(String[] args) {
        //List<File> list = getFiles("/Users/lining/Desktop/pdftest/zip");
        //list.forEach(file -> System.out.println(file.getPath()));
        File file = new File("/Users/lining/Desktop/pdftest/hello.pdf");
        System.out.println(file.getName());
    }

    public static List<File> getFiles(String baseDir){
        List<File> list = new ArrayList<>();
        File dir = new File(baseDir);
        File[] files = dir.listFiles();
        for(File file : files){
            if(file.isDirectory())list.addAll(getFiles(file.getPath()));
            else list.add(file);
        }
        return list;
    }
}
